<?php
/**
 * Created by PhpStorm
 * USER MingTingLiang   QQ 915802070
 * Date 2020-12-15-015   9:29
 */


abstract class ProdLoadTemplate
{
    public function loadData($id, $type)
    {
        $this->setXX();
        $this->setClick($id);
        $this->setLog($id);

        return new class($id, $type) {
            public function __construct($id, $type)
            {
                $arr = ['product_id' => 1006, 'product_name' => '三国演义'];
                foreach ($arr as $k => $v) {
                    $this->$k = $v;
                }
            }
        };
    }

    abstract function setClick($id);        // 设置点击量

    abstract function setLog($id);      // 设置日志

     function setXX()
    {
        echo "通用方法";
    }
}